package com.jymj.service.impl;

import com.jymj.dao.SysXzqDao;
import com.jymj.entity.SysXzqEntity;
import com.jymj.service.SysProjXzqService;
import com.jymj.service.SysXzqRoleService;
import com.jymj.service.SysXzqService;
import com.jymj.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/5/16.
 */
@Service("sysXzqService")
public class SysXzqServiceImpl implements SysXzqService {

    @Autowired
    private SysXzqDao sysXzqDao;
    @Autowired
    private SysProjXzqService sysProjXzqService;
    @Autowired
    private SysXzqRoleService sysXzqRoleService;

    @Override
    public SysXzqEntity queryObject(Long xzqId) {
        return sysXzqDao.queryObject(xzqId);
    }

    @Override
    public List<SysXzqEntity> queryList(Map<String, Object> map) {
        return sysXzqDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return sysXzqDao.queryTotal();
    }

    @Override
    public void save(SysXzqEntity xzq) {
        sysXzqDao.save(xzq);
    }

    @Override
    public void update(SysXzqEntity xzq) {
        sysXzqDao.update(xzq);
    }

    @Override
    public void deleteBatch(Long[] xzqIds) {
        sysXzqDao.deleteBatch(xzqIds);
    }

    @Override
    public List<SysXzqEntity> getUserXzqList(Long userId) {
        List<SysXzqEntity> xzqList  = sysXzqRoleService.queryXzqList(userId);
        return xzqList;
    }

    @Override
    public List<SysXzqEntity> getXzqInfoList(Long userId, String xzqmc, String code) {
        return sysXzqDao.getXzqInfoList(userId,xzqmc,code);
    }

    @Override
    public List<SysXzqEntity> queryXzqObject(String xzqmc) {
        return sysXzqDao.queryXzqObject(xzqmc);
    }

    @Override
    public List<SysXzqEntity> queryXzqList(String code, Integer type) {
        Map map = new HashMap();
        map.put("code",code);
        map.put("type",type);
        map.put("sysUser", ShiroUtils.getUserEntity());
        return sysXzqDao.queryList(map);
    }

    @Override
    public List<SysXzqEntity> getUserDistrictList(Long userId) {
        return sysXzqRoleService.getUserDistrictList(userId);
    }

    @Override
    public List<SysXzqEntity> getUserTownList(Long userId) {
        return sysXzqRoleService.getUserTownList(userId);
    }

    @Override
    public List<String> qeryCode(Long userId) {
        return sysXzqRoleService.qeryCode(userId);
    }
}
